<template>
	<view class="upload">
		<!-- <u-tabs :list="table" :scrollable='false' @click="selectTab" bg-color="#F5F5F5" lineColor="#00C777" 
			:current="tabIndex" @change="pickerChange" lineWidth="60" :activeStyle="{
            color: '#00C777',
            transform: 'scale(1.05)'
        }"></u-tabs> -->
		<supUpload :edit="id" :sOrb="sOrb" :listType="tabIndex" ref="supUpload" :type="gotype" @changeType="changeType"></supUpload>

	</view>
</template>

<script>
	import supUpload from '@/pages/upload/supUpload.vue'
	export default {
		components: {
			supUpload
		},
		onShareAppMessage() {
			return {
				title: '苗木超市',
				path: '/pages/index/index',
		
			}
		},
		onShareTimeline: function() {
			return {
				title: '苗木超市',
				path: '/pages/index/index',
			}
		},
		data() {
			return {
				tabIndex: 0,
				table: [{
					name: '供应上传'
				}, {
					name: '求购上传'
				}],
				list: [],
				page: 1,
				last_page: 1,
				categorys: [],
				map: false,
				gotype: 'other' ,//是否从地图页面过来,
				id:0,
				sOrb: ''
			}
		},
		onHide() {
			getApp().globalData.switchId = ''//离开页面都将跳转的switchId为空，消除是从首页跳过来标识
		},
		onShow() {
			// if(this.type !='supply' || this.type !='buy')
			// this.come = false
			let switchId = getApp().globalData.switchId
			// console.log(switchId,'switchId')
			if(switchId == 'index'){
				this.tabIndex = 1
			}
			this.$refs.supUpload.getTypeList()
			this.$refs.supUpload.getCity()
			this.$refs.supUpload.GetSpecsList()
			this.$refs.supUpload.getUser()
		},
		onPullDownRefresh() {
			this.$refs.supUpload.getTypeList()
			this.$refs.supUpload.getCity()
			this.$refs.supUpload.GetSpecsList()
			this.$refs.supUpload.getUser()
			this.$refs.supUpload.emptForm()
			setTimeout(function() {
				uni.stopPullDownRefresh();
			}, 500);
		},
		onLoad(res) {
			this.tabIndex = 1
			this.id = res.id,
			this.sOrb = res.from
			
			uni.$on('map', e => { //
				this.gotype = 'map'
			})
		},
		methods: {
			changeType(){
				this.gotype = 'other'
			},
			selectTab(e) {
				this.tabIndex = e.index
				console.log(this.tabIndex,'hfff')
			},
			pickerChange(e) {
				this.tabIndex = e.index
				// console.log(e)
			}

		}
	}
</script>
<style>
	/* @page{
		background-color: #E2E2E2;
	} */
	page {
		background-color: #f6f6f6;
		min-height: 100vh;
	}
</style>
